AU = 149598000000 # meters

class SolarSystem:
    """ Solar System 
        
        contains a
        
        Core, basically centered at 0,0,0 in the system. Binary Systems, have a binary core, for ease of calculation
    """
        
    def __init__(self):
        self.bodies  = [] # Dictionary of Solar Bodies, with an Index of their radius in AU, center mass at the center of the system, most of the time is a single star
        self.name = None
    
        self.x = 0 # lightyears
        self.y = 0
        self.z = 0
                    
    def addBody(self, radius, obj):
        obj.orbit=radius
        obj.system=self
        self.bodies.append(obj)
        
    def setCore(self, obj):
        obj.orbit=0
        obj.system=self
        self.bodies.insert(0,obj)
        
    def getCore(self):
        return self.bodies.index(0)
    
    def __str__(self):
        self.status()
        
    def status(self):
        print("System: "  + self.name)
        print("Galaxtic Location: " + str(self.x) + "," + str(self.y) + "," + str(self.z))
        
        for body in self.bodies:
            if body != None:
                print(body)

    
class SolarBody:
    """ Solar Body"""
    radius = 0 # Radius in Kilometers
    
    mass = 0 # in Kilograms 
    
    name = None
    system = None # link back to the system the body belongs to
    
    orbit = 1 # radius of the orbit around the central mass of the system in AU

    type = None# body type    
    letterCode = ""
    
    def getName(self):
        if None == self.name:
            self.name = self.system.name + " "  +  str(self.system.bodies.index(self))
            
        return self.name
    
    def getSurfaceGravity(self):
        return (6.67 * 10**-11) * mass / raduis**2
    
    #def __cmp__(self, other):
    #    return cmp(self.orbit, other.orbit)   